import {
    Column,
    CreateDateColumn,
    Entity,
    JoinColumn,
    OneToOne,
    PrimaryGeneratedColumn,
    UpdateDateColumn,
} from 'typeorm';
import { User } from './user.entity';


// Entity 装饰器  定义实体
@Entity('profile')
export class Profile {
    @PrimaryGeneratedColumn('uuid') // 设置主键
    id: string;

    @Column({
        type: 'int',
        comment: '性别',
    })
    gender: number;

    @Column({
        type: 'varchar',
        length: 50,
        comment: '地址',
    })
    address: string;

    @CreateDateColumn()
    createdAt: Date;

    @UpdateDateColumn()
    updatedAt: Date;

    // 创建外键约束   一对一的关系
    @OneToOne(() => User)
    @JoinColumn()
    user: User;
}
